#!/usr/bin/env bash

set -x
name=my-mongo

containers=$(docker ps | grep  ${name})
if [[ '' != "${containers}" ]] ; then
    echo "[${name}] already started, do nothing."
    exit 0
fi


containers=$(docker ps -a | grep  ${name})
if [[ '' != "$containers" ]]; then
    docker rm ${name}
fi


docker run \
    -p 27017:27017 \
    -d \
    --rm \
    --name ${name} \
    -v ~/my-mongo/data/db:/data/db \
    mongo:3.5.6
